package com.weactivity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.weactivity.dto.CommentDTO;
import com.weactivity.dto.SendCommentDTO;
import com.weactivity.entity.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CommentMapper extends BaseMapper<Comment> {

    List<CommentDTO> findAllById(int aid);

    @Insert("insert into comments (activity_id,user_id,content,parent_comment_id,create_time)" +
            " values (#{DTO.activityId},#{uid},#{DTO.content},#{DTO.parentCommentId},Now());")
    int addComment(@Param("uid") Long uid, @Param("DTO") SendCommentDTO sendCommentDTO);
}
